package moe.bogos.douro.api.common;

import moe.bogos.douro.api.common.soul.skill.ChangeableSkillContainer;
import moe.bogos.douro.api.common.soul.skill.Skill;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.ListNBT;

import java.util.HashSet;
import java.util.Set;

public abstract class AgedSkillContainer extends AgedSoul implements ChangeableSkillContainer
{
    protected Set<Skill> skills = new HashSet<Skill>();
    
    public AgedSkillContainer(int year, Skill... skills)
    {
        super(year);
        if (skills == null)
        {
            return;
        }
        for (Skill skill : skills)
        {
            this.skills.add(skill);
        }
    }
    
    public Set<Skill> getSkills()
    {
        return skills;
    }
    
    @Override
    public void setSkills(Set<Skill> skills)
    {
        this.skills = skills;
    }
    
    public CompoundNBT writeToNbt()
    {
        CompoundNBT nbt = super.writeToNbt();
        ListNBT skillList = new ListNBT();
        int i = 0;
        for (Skill skill : this.getSkills())
        {
            //skillList.add(i++, skill.writeToNbt());
        }
        nbt.put(Constants.SKILLS, skillList);
        return nbt;
    }
}
